rm(list=ls())

##############################################################################
# APPENDIX B5 TABLE 1
##############################################################################

# load data 
load("data/eurepoc_year_attacks_incidents.RData")
load("data/imputed_data_incidents.RData")

##############
# RUN MODELS #
##############

#model 1 (eurepoc attacks incidents)
m1 <- lm(attacks ~ treat + factor(country_spell), data = eurepoc_year_data_incident)

#model 2 (eurepoc attacks control)
d.long.incidents$log_tech_articles <- log(d.long.incidents$tech_articles + 1)

imp.candidates <- as.mids(d.long.incidents)

fit.A <- with(imp.candidates, lm(attacks ~  treat + factor(country_spell) + 
                                   internet_usage + ict_exports + log_tech_articles))
m2 <- pool(fit.A)

################
# CREATE TABLE #
################

appendB5_tab1 <- screenreg(list(m1, m2), custom.coef.map = list("treat" = "candidate", 
"internet_usage" = "internet usage", 
"ict_exports" = "ICT exports", 
"log_tech_articles" = "log tech articles"),
omit.coef = c("country_spell"),
custom.gof.rows = list("Country Spell FE" = c("YES", "YES")), digits = 3, stars = c(0.001, 0.01, 0.05, 0.1))

print(appendB5_tab1)

# script complete message 
print("appendB5_tab1 complete")


